package com.ruoyi.hk.mapper;

import com.ruoyi.hk.domain.User;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/*user_name,nick_name,user_type_id,phonenumber,password,department_type_id*/
@Mapper
public interface UserMapper {
    Integer addUser(User User);

    @Select("select count(*) from sys_user where phonenumber=#{phonenumber}")
    Integer getUserPhone(String phonenumber);

    @Select("select count(*) from sys_user where nick_name=#{nickName}")
    Integer getNickName(String nickName);

    Integer addUserRole(@Param("userId") Long userId, @Param("userType") String userType);

    @Select("select count(*) from sys_user where user_name=#{userName}")
    Integer getUserName(String userName);

    @Select("select * from sys_user where user_id = #{userId}")
    User getById(Long userId);

    @Select("select * from sys_user where user_id = #{otherUserId}")
    User selectById(Long otherUserId);

    @Select("select * from sys_user where user_id != #{userId} and status = #{status}")
    List<User> getUserAll(Map<String, Object> params);


}
